﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Stats.Objects
{
    /// <summary>
    /// this object represent all the properties of a trip
    /// </summary>
    public class TripProperties
    {
        /// <summary>
        /// the Id of the trip
        /// </summary>
        public int ID { get; set; }

        /// <summary>
        /// the departure date
        /// </summary>
        public DateTime DepartureDate { get; set; }

        /// <summary>
        /// the town where the trip begins
        /// </summary>
        public String OriginCity { get; set; }

        /// <summary>
        /// the address of the trip begins
        /// </summary>
        public String OriginAddress { get; set; }

        /// <summary>
        /// the trip arrival town
        /// </summary>
        public String DestinationCity { get; set; }

        /// <summary>
        /// the trip arrival address
        /// </summary>
        public String DestinationAddress { get; set; }

        /// <summary>
        /// the average of free seats in a trip
        /// </summary>
        public double AvgFreeSeats { get; set; }

        /// <summary>
        /// true if is no longer possible to join the trip
        /// </summary>
        public bool ExpiredTrip { get; set; }

        /// <summary>
        /// visual disponibility for the trip
        /// </summary>
        public int Visual_Avaiability { get; set; }

        /// <summary>
        /// Creates the object TripProperties
        /// </summary>
        /// <param name="trip_id">the Id of the trip</param>
        /// <param name="departure_date">the departure date</param>
        /// <param name="origin_city">the town where the trip begins</param>
        /// <param name="origin_address">the address of the trip begins</param>
        /// <param name="destination_city">the trip arrival town</param>
        /// <param name="destination_address">the trip arrival address</param>
        /// <param name="avg_freeSeats">the average of free seats in a trip</param>
        /// <param name="expiredFlag">true if is no longer possible to join the trip</param>
        public TripProperties(int trip_id, DateTime departure_date, String origin_city, String origin_address, String destination_city, String destination_address, double avg_freeSeats, bool expiredFlag)
        {
            ID = trip_id;
            DepartureDate = departure_date;

            OriginCity = origin_city;
            OriginAddress = origin_address;

            DestinationCity = destination_city;
            DestinationAddress = destination_address;

            AvgFreeSeats = avg_freeSeats;

            ExpiredTrip = expiredFlag;

            Visual_Avaiability = (int) Math.Round(avg_freeSeats/10);
        }


        

    }
}
